home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-30 | 3.0 KB | 165 lines | [TEXT/KAHL] |
- /******************************************************************************
- CAccordionPaneDemoDir.c
-
- To install this Showcase demo, follow these two easy steps:
-
- 1) Add these source files to the CSApplication project.
-
- * CAccordionPane
- CAccordionPaneDemoDir
- Parser.c
-
- [ Those marked with an * are the files necessary when using
- the CAccordionPane class. The others are only for this demo. ]
-
- 2) Add all resources in "CAccordionPaneDemo.rsrc" to the
- Showcase resource file "CSApplication π.rsrc".
-
- 3) Recompile and run.
-
- SUPERCLASS: CShowcaseDemoDir
- REQUIRES: CAccordionPane
- AUTHOR: Andrew_Gilmartin@Brown.Edu
- MODIFIED: 93-03-05
-
- ******************************************************************************/
-
-
- //#include <TCLHeaders>
- //#include "config.h"
- #include "CAccordionPaneDemoDir.h"
- #include "Parser.h"
-
- char* gPaneStructure[] = {
-
- /* 3 panes vertically */
-
- "V 1 \
- E 1 \
- E 1 \
- E 2 .",
-
- /* 3 panes horizontally */
-
- "H 1 \
- E 1 \
- E 2 \
- E 1 .",
-
- /* 2 x 2 grid of panes */
-
- "V 1 \
- H 1 \
- E 1 \
- E 1 \
- . \
- H 1 \
- E 1 \
- E 1 \
- . \
- . ",
-
- /* A Smalltalk-ish browser */
-
- "V 1 \
- H 1 \
- E 1 \
- E 1 \
- E 1 \
- . \
- E 2 \
- .",
-
- /* 3 x 3 grid of panes */
-
- "V 1 \
- H 1 \
- F 75 \
- E 1 \
- E 1 \
- . \
- H 1 \
- E 2 \
- E 1 \
- E 2 \
- . \
- H 1 \
- E 1 \
- E 1 \
- F 75 \
- . \
- . ",
-
- };
-
- #define gPaneStructureCount ( sizeof( gPaneStructure ) / sizeof( char* ) )
-
-
- /******************************************************************************
- INewDemo
-
- ******************************************************************************/
-
- #define kMargin 16
-
- void CAccordionPaneDemoDir::INewDemo( CDirectorOwner *aSupervisor )
- {
- CSizeBox* theSizeBox;
- LongRect theInterior;
- CPane* thePane;
- CPaneBorder* theBorder;
- Rect kBorderMargin = { 0, 0, 0, 0 };
- static int whichStructure = 0;
-
- SetCursor( *gWatchCursor );
-
- inherited::INewDemo( aSupervisor );
-
- itsWindow = new CWindow;
- itsWindow->IWindow( 128, FALSE, gDesktop, this );
-
- theSizeBox = new CSizeBox;
- theSizeBox->ISizeBox( itsWindow, aSupervisor );
-
- /*
- Put the panes inside a bordered pane.
- This way we can "see" all the edges.
- */
-
- itsWindow->GetInterior( &theInterior );
-
- thePane = new CPane;
- thePane->IPane
- ( itsWindow
- , itsWindow->itsSupervisor
- , theInterior.right - ( kMargin * 2 )
- , theInterior.bottom - ( kMargin * 2 )
- , kMargin
- , kMargin
- , sizELASTIC, sizELASTIC );
- thePane->SetWantsClicks( TRUE );
-
- theBorder = new CPaneBorder;
- theBorder->IPaneBorder( kBorderFrame );
- theBorder->SetMargin( &kBorderMargin );
- theBorder->SetPattern( gray );
- thePane->SetBorder( theBorder );
-
- /*
- Make the panes.
-
- NOTE: there are N pane arrangements encoded. Each call to
- INewDemo() makes the next in sequence.
- */
-
- MakePanes
- ( thePane
- , gPaneStructure[ whichStructure++ % gPaneStructureCount ] );
-
- /* Show the window */
-
- gDecorator->StaggerWindow( itsWindow );
- itsWindow->Select();
-
- } /* INewDemo */
-